<?php
    $item_menu[0] = 'News'; 
    $item_menu[1] = 'phpmailer'; 

	require('../../inc/config.php');
	if (!isset($_SESSION["admin"])) {redirect(ADMIN."login.php");	exit(); }
	include('../header.php');
	
    $title = 'Configuración de PHP Mailer para envio de Boletines';
    
	$submit = request('submit','');
	$panel = 8;
    if (!empty($submit)) {
		foreach ($_POST as $clave => $valor){
			$sql 	= "update setting  set valor = '$valor' where name='$clave' and panel='$panel'";
			$rs 	= $db->Execute($sql);
		}
        echo mensaje_ok("Los cambios se guardaron correctamente");
	}

	$sql 	= "select * from setting where panel='$panel' order by orden ASC";
	$rs 	= $db->Execute($sql);
	$stt	= $rs->GetRows();


?>
<h2><?php echo $title;?></h2>

<form action='config_phpmailer.php'  method='post' class="form-horizontal" role="form" >
	<?php foreach ($stt as $clave => $valor){ ?>
		<div class="form-group">
			<label class="col-sm-5 control-label" for="id_<?php echo $clave;?>"><?php echo $valor['desc'];?></label>
			<div class="col-sm-5">
				<input type='text' id="id_<?php echo $clave;?>" name='<?php echo $valor['name'];?>' value='<?php echo $valor['valor'];?>' class="form-control"/>
			</div>
		</div>	
	<?php } ?>
	
	<div class="form-group">
		<label class="col-sm-5 control-label" > </label>
		<div class="col-sm-5">
			<input type="hidden" name="panel" value="<?php echo $panel;?>" />
			<input type="submit" name="submit" class='btn btn-primary' value="Guardar Cambios" />
		</div>
	</div>	
</form>

<p class="bg-info" style='padding:10px;'>
<strong>Ejemplo para configuración con Gmail:</strong><br>
PHPMailer_Auth: Requiere Autorizacion (true | false): <b>true</b><br>
PHPMailer_Secure: Servidor seguro (ssl | tsl): <b>ssl</b><br>
PHPMailer_Host: Servidor de correo: <b>smtp.gmail.com</b>	<br>
PHPMailer_Port: Puerto (465 | 587): <b>465</b><br>
PHPMailer_Username: <b>email@gmail.com</b><br>
PHPMailer_Password: <b>contraseña de gmail</b>	
</p>